using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PingpongScale : MonoBehaviour
{
    public Vector3 minScale, maxScale;
    public float scaleSpeed;
    
    private float phase = 0f;

    void Update()
    {
        // 使用正弦函数实现平滑的来回运动
        phase += Time.deltaTime * scaleSpeed;
        float scaleFactor = 0.5f + 0.5f * Mathf.Sin(phase);
        
        transform.localScale = Vector3.Lerp(minScale, maxScale, scaleFactor);
    }
}